package cn.kust.serviceinterestpoint.service.impl;

import cn.kust.serviceinterestpoint.entity.InterestInterestCategory;
import cn.kust.serviceinterestpoint.mapper.InterestInterestCategoryMapper;
import cn.kust.serviceinterestpoint.service.InterestInterestCategoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author microTourism
 * @since 2022-07-28
 */
@Service
public class InterestInterestCategoryServiceImpl extends ServiceImpl<InterestInterestCategoryMapper, InterestInterestCategory> implements InterestInterestCategoryService {

    @Override
    public void addInterestCategorys(Long interestId, Long[] categoryIds) {

        InterestInterestCategory interestCategory = new InterestInterestCategory();
        interestCategory.setInterestId(interestId);
        for (Long categoryId : categoryIds) {
            interestCategory.setCategoryId(categoryId);
            //将兴趣点-分类关联写入数据库。
            baseMapper.insert(interestCategory);
        }
    }
}
